package LeetCode.month01.day28;

public class No2529 {
    public static void main(String[] args) {
        System.out.println(maximumCount(new int[]{0,0}));
    }
    public static int maximumCount(int[] nums) {
        int n = nums.length;
        int left = 0,right = n-1;
        int le=-1,ri=n;
        while(left<=right){
            int mid = left+(right-left)/2;
            if(nums[mid]>0){
                right = mid-1;
                ri = mid;
            }else {
                left=mid+1;
            }
        }
        left = 0;
        right = n-1;
        while(left<=right){
            int mid = left+(right-left)/2;
            if(nums[mid]<0){
                left = mid+1;
                le = mid;
            }else {
                right=mid-1;
            }
        }
        if(le==-1&&ri==n) {
            return 0;
        }
        return Math.max(le+1,n-ri);
    }
}
